package com.example.importannotation.ImportBeanDefinitionRegistrar;

import com.example.importannotation.importSelector.Cat;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @program my-project-model
 * @description:
 * @author: lee
 * @create: 2022/06/13 16:08
 */
public class MyBeanDefinitionRegister implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        RootBeanDefinition catDef = new RootBeanDefinition(Cat.class);
        RootBeanDefinition carDef = new RootBeanDefinition(Car.class);
        registry.registerBeanDefinition("cat", catDef);
        registry.registerBeanDefinition("car", carDef);
    }
}
